import { GetterTree } from 'vuex';

import { RootState } from '@/store';

import { State } from './state';

export type Getters = {
    token(state: State): string;
    avatar(state: State): string;
    username(state: State): string;
    nickName(state: State): string;
    roles(state: State): string[];
    userInfo(state: State): any;
};

export const getters: GetterTree<State, RootState> & Getters = {
    token: (state) => state.token,
    avatar: (state) => state.avatar,
    username: (state) => state.username,
    nickName: (state) => state.nickName,
    roles: (state) => state.roles,
    userInfo: (state) => state.userInfo,
};
